//
//  AWSystemChatMessage.m
//  AtWork2
//
//  Created by lucas on 15/6/2.
//  Copyright (c) 2015年 Foreveross. All rights reserved.
//

#import "AWSystemChatMessage.h"
#import "ATWUtil.h"

@implementation AWSystemChatMessage

+ (instancetype)systemChatMessageWithFrom:(NSString *)from to:(NSString *)to content:(NSString *)content {
    AWSystemChatMessage *chatMessage =  [[self alloc] initWithFrom:from to:to content:content];
    chatMessage.deliveryTime = [ATWUtil dateOfServerTimestamp];
    return chatMessage;
}

- (instancetype)initWithFrom:(NSString *)from to:(NSString *)to content:(NSString *)content {
    if (self = [super initWithFrom:from to:to messageType:AWMessageTypeChat]) {
        self.chatMessageType = AWChatMessageTypeSystem;
        self.content = content;
    }
    return self;
}

- (void)setContent:(NSString *)content {
    [self bodyWithKey:AWMessageKContent value:content];
}

- (NSString *)content {
    return [self bodyValueForKey:AWMessageKContent];
}

- (NSString *)searchableContent {
    return self.content;
}

@end
